﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Perform
{
    public partial class frmUserM : Form
    {
        private string uname;
        public string Uname
        {
            get { return uname; }
            set { uname = value; }
        }
        public frmUserM()
        {
            InitializeComponent();
        }

        private void lblPrompt_Click(object sender, EventArgs e)
        {

        }

        private void btnYes_Click(object sender, EventArgs e)
        {
            string pas1 = txtpas.Text.Trim();
            string pas2 = txtpas2.Text.Trim();
            string sql = string.Format("update [User] set uPassword = '{0}' where uName = '{1}'", pas1, Uname); 
            if(pas1 != pas2)
            {
                MessageBox.Show("两次输入的密码不同，请重新输入！");
                txtpas.Clear();
                txtpas2.Clear();
            }
            else if(pas1 == "" || pas2 == "")
            {
                MessageBox.Show("请输入密码！");
                txtpas.Clear();
                txtpas2.Clear();
            }
            else
            {
                Dal.DataHelper.sqlExecuteNonQuery(sql);
                MessageBox.Show("密码更改成功！");

            }

        }

        private void frmUserM_Load(object sender, EventArgs e)
        {

        }
        public void onClickEvent(string name)
        {
            Uname = name;
        }
    }
}
